package net.sareweb.acab.entity;

// Generated 13-abr-2010 15:53:20 by Hibernate Tools 3.2.5.Beta

import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.hibernate.validator.Length;
import org.hibernate.validator.NotNull;

/**
 * Country generated by hbm2java
 */
@Entity
@Table(name = "country", catalog = "acab")
public class Country implements java.io.Serializable {

	private Integer idCountry;
	private String name;
	private String code;
	private Set<Travel> travelsForFromCountry = new HashSet<Travel>(0);
	private Set<State> states = new HashSet<State>(0);
	private Set<Request> requestsForToCountry = new HashSet<Request>(0);
	private Set<Request> requestsForFromCountry = new HashSet<Request>(0);
	private Set<Travel> travelsForToCountry = new HashSet<Travel>(0);

	public Country() {
	}

	public Country(String name) {
		this.name = name;
	}

	public Country(String name, String code, Set<Travel> travelsForFromCountry,
			Set<State> states, Set<Request> requestsForToCountry,
			Set<Request> requestsForFromCountry, Set<Travel> travelsForToCountry) {
		this.name = name;
		this.code = code;
		this.travelsForFromCountry = travelsForFromCountry;
		this.states = states;
		this.requestsForToCountry = requestsForToCountry;
		this.requestsForFromCountry = requestsForFromCountry;
		this.travelsForToCountry = travelsForToCountry;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "idCountry", unique = true, nullable = false)
	public Integer getIdCountry() {
		return this.idCountry;
	}

	public void setIdCountry(Integer idCountry) {
		this.idCountry = idCountry;
	}

	@Column(name = "name", nullable = false, length = 200)
	@NotNull
	@Length(max = 200)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "code", length = 45)
	@Length(max = 45)
	public String getCode() {
		return this.code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "countryByFromCountry")
	public Set<Travel> getTravelsForFromCountry() {
		return this.travelsForFromCountry;
	}

	public void setTravelsForFromCountry(Set<Travel> travelsForFromCountry) {
		this.travelsForFromCountry = travelsForFromCountry;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "country")
	public Set<State> getStates() {
		return this.states;
	}

	public void setStates(Set<State> states) {
		this.states = states;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "countryByToCountry")
	public Set<Request> getRequestsForToCountry() {
		return this.requestsForToCountry;
	}

	public void setRequestsForToCountry(Set<Request> requestsForToCountry) {
		this.requestsForToCountry = requestsForToCountry;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "countryByFromCountry")
	public Set<Request> getRequestsForFromCountry() {
		return this.requestsForFromCountry;
	}

	public void setRequestsForFromCountry(Set<Request> requestsForFromCountry) {
		this.requestsForFromCountry = requestsForFromCountry;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "countryByToCountry")
	public Set<Travel> getTravelsForToCountry() {
		return this.travelsForToCountry;
	}

	public void setTravelsForToCountry(Set<Travel> travelsForToCountry) {
		this.travelsForToCountry = travelsForToCountry;
	}

}
